import pygame
from didiball.planes.Pitch import *

class ViewPort():
        
	def __init__(self,screen,pitch):
		self.__screen= screen
		self.__pitch= pitch
                self.update_inner()
        def get_inner(self):
                return self.__inner
        def update_inner(self):
                rect= self.__screen.get_rect() 
		self.__inner= pygame.Rect(rect.left+rect.width/5,rect.top+rect.height/5,rect.width*2/3,rect.height*2/3)
	def inner_contains(self,other):
		if self.__screen.get_rect().contains(other):
                        self.update_inner()
                        if self.__inner.contains(other):
                                return True
                        else:
                                return False
                else:
                        return False

	def centre(self,other):
                pass
		#
#                amt=10
#                if self.__pitch.get_rect().left<other[0]-self.__inner.width/2:
#                        self.__pitch.get_rect().left+=amt
#                elif self.__pitch.get_rect().left>other[0]+self.__inner.width/2:
#                        self.__pitch.get_rect().left-=amt
#                if self.__pitch.get_rect().top<other[1]-self.__inner.height/2:
#                        self.__pitch.get_rect().top+=amt
#                elif self.__pitch.get_rect().top>other[1]+self.__inner.height/2:
#                        self.__pitch.get_rect().top-=amt
		#print "centring!"
